Get the position correctly for the root window. Fixes bug #347976, patch
authorRichard Hult <richard@imendio.com>
Wed, 19 Jul 2006 07:28:42 +0000 (07:28 +0000)
committerRichard Hult <rhult@src.gnome.org>
Wed, 19 Jul 2006 07:28:42 +0000 (07:28 +0000)
2006-07-19  Richard Hult  <richard@imendio.com>

* gdk/quartz/gdkwindow-quartz.c:
(_gdk_windowing_window_get_pointer): Get the position correctly
for the root window. Fixes bug #347976, patch by Dave Vasilevsky.

ChangeLog
ChangeLog.pre-2-10
gdk/quartz/gdkwindow-quartz.c

index e04082051ac61cbe49fac8b70aaa8ca997d00742..7b832ebfdae1f26e436389f5c266aae89ac3b4e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-07-19  Richard Hult  <richard@imendio.com>
+
+       * gdk/quartz/gdkwindow-quartz.c:
+       (_gdk_windowing_window_get_pointer): Get the position correctly
+       for the root window. Fixes bug #347976, patch by Dave Vasilevsky.
+
 2006-07-18  Matthias Clasen  <mclasen@redhat.com>
 
        * NEWS: Updates
index e04082051ac61cbe49fac8b70aaa8ca997d00742..7b832ebfdae1f26e436389f5c266aae89ac3b4e6 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-19  Richard Hult  <richard@imendio.com>
+
+       * gdk/quartz/gdkwindow-quartz.c:
+       (_gdk_windowing_window_get_pointer): Get the position correctly
+       for the root window. Fixes bug #347976, patch by Dave Vasilevsky.
+
 2006-07-18  Matthias Clasen  <mclasen@redhat.com>
 
        * NEWS: Updates
index 948d84af1a474c9562b0154a3858bca77c117b98..2114f3987b45a432873125592e4aa5620bf354c4 100644 (file)
@@ -974,27 +974,36 @@ _gdk_windowing_window_get_pointer (GdkDisplay      *display,
   GdkWindow *toplevel = gdk_window_get_toplevel (window);
   GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
   GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
-  NSWindow *nswindow = impl->toplevel;
-  NSPoint point = [nswindow mouseLocationOutsideOfEventStream];
+  NSPoint point;
   int x_tmp, y_tmp;
 
-  /* FIXME: Might need to special-case window being the root window. */
-  
-  /* First flip the y coordinate */
+  /* Must flip the y coordinate. */
+  if (window == _gdk_root)
+    {
+      point = [NSEvent mouseLocation];
+      y_tmp = _gdk_quartz_get_inverted_screen_y (point.y);
+    }
+  else
+    {
+      NSWindow *nswindow = impl->toplevel;
+      point = [nswindow mouseLocationOutsideOfEventStream];
+      y_tmp = impl->height - point.y;
+    }
   x_tmp = point.x;
-  y_tmp = impl->height - point.y;
       
-  while (private != GDK_WINDOW_OBJECT (toplevel)) {
-    x_tmp -= private->x;
-    y_tmp -= private->y;
+  while (private != GDK_WINDOW_OBJECT (toplevel))
+    {
+      x_tmp -= private->x;
+      y_tmp -= private->y;
     
-    private = private->parent;
-  }
+      private = private->parent;
+    }
 
-  if (x)
-    *x = x_tmp;
-  if (y)
-    *y = y_tmp;
+  *x = x_tmp;
+  *y = y_tmp;
+
+  /* FIXME: Implement mask. */
+  *mask = 0;
 
   /* FIXME: Implement return value */
   return NULL;